package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyRedissionConfig {

    @Bean(destroyMethod = "shutdown")
    public RedissonClient redissonClient(){
        //创建配置
        Config config = new Config();
        config.useSingleServer().setAddress("redis://redis:6379");
        //根据config创建RedissonClient实例
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }
}
